/**
 * Created by x298017064010 on 17/3/23.
 *
 * 这里是提交mutations, 而不是直接更改状态(异步事务), 调用: this.$store.dispatch('increment')
 */

// root
export function incrementAsync({ commit }, payload) {
    setTimeout(() => {
        commit('increment', payload)
    }, 1000)
}

// todo
export function ADD_TODO_MSG_ASYNC ({ state, commit, rootState }, payload) {
    // state 模块的局部状态
    setTimeout(() => {
        commit('ADD_TODO_MSG', payload)
    }, 1000)
}
export function DELETE_TODO_MSG_ASYNC ({ state, commit, rootState }, payload) {
    commit('DELETE_TODO_MSG', payload)
}
export function QUERY_TODO_MSG_ASYNC ({ state, commit, rootState }, payload) {
    commit('QUERY_TODO_MSG', payload)
}